package com.example.ota_ble

import android.app.Application
import android.view.View
import android.widget.ScrollView
import android.widget.TextView
import androidx.lifecycle.ViewModel

object globbal_calss {
    lateinit var  printf_tempinal:TextView

    fun register_tempinal(tempinal:TextView)
    {
        this.printf_tempinal = tempinal
    }
    fun printf_to_tempinal(str: String?)
    {
        if(printf_tempinal==null) return

        val currentText = printf_tempinal.text.toString()
        val updatedText = "$currentText\n$str"
        printf_tempinal.text = updatedText
        //printf_tempinal.scrollTo(0, printf_tempinal.height)
        (printf_tempinal.parent as? ScrollView)?.fullScroll(View.FOCUS_DOWN)


    }
}